package request;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 域数据的获取
 * @author Mc.Chai
 * @program: JavaWeb
 * @create 2022-03-20-21:18 21:18
 */
@WebServlet("/myRequest8")
public class MyRequest8 extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("myRequest8被访问了....");
        //根据域中的键来获取值
        Object name = request.getAttribute("name");
        System.out.println(name);
    }
}
